﻿using System.Collections.Generic;
using MigratorCore.Bases;
using System;
namespace MigratorCore.Objects
{
    /// <summary>
    /// User Base Object Class
    /// </summary>
    public class User : MigratorCore.Bases.Object
    {
        /// <summary>
        /// Roles user has
        /// </summary>
        private List<string> roles;
        /// <summary>
        /// User's Email Address
        /// </summary>
        private string email;
        private System.DateTime datejoined;

        public System.DateTime Datejoined
        {
            get { return datejoined; }
            set { datejoined = value; }
        }
        private System.DateTime datelastvisited;

        public System.DateTime Datelastvisited
        {
            get { return datelastvisited; }
            set { datelastvisited = value; }
        }

        public string Email
        {
            get { return email; }
            set { email = value; }
        }

        /// <summary>
        /// Roles user has
        /// </summary>
        public List<string> Roles
        {
            get { return roles; }
            set { roles = value; }
        }


        public User()
        {
            this.Name = "";
            this.attributes = new System.Collections.Specialized.NameValueCollection();
            this.Msn = "";
            this.Aol = "";
            this.avatarUrl = "";
            this.Bio = "";
            this.commonName = "";
            this.datejoined = DateTime.Now;
            this.datelastvisited = DateTime.Now;
            this.email = "";
            this.enableEmail = false;
            this.EnableEmoticons = false;
            this.Icq = "";
            this.Interests = "";
            this.isBanned = false;
            this.isModerated = true;
            this.Occupation = "";
            this.roles = new List<string>();
            this.Signature = "";
            this.timezone = 0;
            this.WebAddress = "";
            this.WebBlog = "";
            this.WebGallery = "";
            this.Yahoo = "";

        }

        public User(string Username, string Email)
        {
            this.Name = Username;
            this.attributes = new System.Collections.Specialized.NameValueCollection();
            this.Msn = "";
            this.Aol = "";
            this.avatarUrl = "";
            this.Bio = "";
            this.commonName = "";
            this.datejoined = DateTime.Now;
            this.datelastvisited = DateTime.Now;
            this.email = Email;
            this.enableEmail = false;
            this.EnableEmoticons = false;
            this.Icq = "";
            this.Interests = "";
            this.isBanned = false;
            this.isModerated = true;
            this.Occupation = "";
            this.roles = new List<string>();
            this.Signature = "";
            this.timezone = 0;
            this.WebAddress = "";
            this.WebBlog = "";
            this.WebGallery = "";
            this.Yahoo = "";
        }

        public string Msn
        {
            get { return this.attributes["msnIM"]; }
            set { this.attributes.Set("msnIM", value); }
        }

        public string Aol
        {
            get { return this.attributes["aolIM"]; }
            set { this.attributes.Set("aolIM", value); }
        }

        public string Yahoo
        {
            get { return this.attributes["yahooIM"]; }
            set { this.attributes.Set("yahooIM", value); }
        }

        public string Icq
        {
            get { return this.attributes["icqIM"]; }
            set { this.attributes.Set("icqIM", value); }
        }

        public string Bio
        {
            get { return this.attributes["icqIM"]; }
            set { this.attributes.Set("icqIM", value); }
        }

        private string commonName;

        public string CommonName
        {
            get { return commonName; }
            set { commonName = value; }
        }

        private bool isBanned;

        public bool IsBanned
        {
            get { return isBanned; }
            set { isBanned = value; }
        }

        private bool isModerated;

        public bool IsModerated
        {
            get { return isModerated; }
            set { isModerated = value; }
        }

        public string Interests
        {
            get { return this.attributes["interests"]; }
            set { this.attributes.Set("interests", value); }
        }

        public string Occupation
        {
            get { return this.attributes["occupation"]; }
            set { this.attributes.Set("occupation", value); }
        }

        public string WebAddress
        {
            get { return this.attributes["webAddress"]; }
            set { this.attributes.Set("webAddress", value); }
        }

        public string WebGallery
        {
            get { return this.attributes["webGallery"]; }
            set { this.attributes.Set("webGallery", value); }
        }

        public string WebBlog
        {
            get { return this.attributes["webLog"]; }
            set { this.attributes.Set("webLog", value); }
        }

        private int timezone;

        public int Timezone
        {
            get { return timezone; }
            set { timezone = value; }
        }

        private bool enableEmail;

        public bool EnableEmail
        {
            get { return enableEmail; }
            set { enableEmail = value; }
        }

        public bool EnableEmoticons
        {
            get { return Boolean.Parse(this.attributes["enableEmoticons"]); }
            set { this.attributes.Set("enableEmoticons", value.ToString()); }
        }

        private string avatarUrl;

        public string AvatarUrl
        {
            get { return avatarUrl; }
            set { avatarUrl = value; }
        }

        public string Signature
        {
            get { return this.attributes["signature"]; }
            set { this.attributes.Set("signature", value); }
        }

        private System.Collections.Specialized.NameValueCollection attributes;

        public System.Collections.Specialized.NameValueCollection Attributes
        {
            get { return attributes; }
            set { attributes = value; }
        }

        private DateTime birthday;

        public DateTime Birthday
        {
            get { return birthday; }
            set { birthday = value; }
        }

        public string Location
        {
            get { return this.attributes["location"]; }
            set { this.attributes.Set("location", value); }
        }
    }
}
